package com.ioc.initialmethod;

import com.sun.media.sound.SoftTuning;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

/**
 * @author cyt
 * @create 2020-07-31 上午 12:31
 * <p>
 * BeanFactoryPostProcessor
 */
@Component
public class Car implements BeanPostProcessor {
    /**
     * @param o : 当前的bean
     * @param s : 当前bean 的名字
     * @return ： 可以返回当前bean, 也可以返回包装之后的bean
     * @throws BeansException
     */
    public Object postProcessBeforeInitialization(Object o, String s) throws BeansException {
        System.out.println(s + " = > " + o);
        return o;
    }

    public Object postProcessAfterInitialization(Object o, String s) throws BeansException {
        System.out.println(s + " = > " + o);
        return o;
    }
}
